package me.idashu.attg.service;

import java.util.List;
import java.util.Map;

import me.idashu.attg.domain.ShopEntity;
import me.idashu.attg.persistence.ShopMapper;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ShopService {
	
	@Autowired
	private ShopMapper shopMapper;

	public void insertShop(ShopEntity shopEntity) {
		shopMapper.insertShop(shopEntity);
	}
	
	public List<ShopEntity> findShopsByPage(Map<String, Object> map){
		List<ShopEntity> shops = shopMapper.findShopsByPage(map);
		return shops;
	}
	
	public int findCountShopsByPage(ShopEntity shopEntity){
		int count = shopMapper.findCountShopsByPage(shopEntity);
		return count;
	}
	
	public ShopEntity findShopById(long id){
		ShopEntity shop = shopMapper.findShopById(id);
		return shop;
	}
	
	public void deleteShop(long id){
		shopMapper.deleteShop(id);
	}
	
	public List<ShopEntity> searchShops(ShopEntity shopEntity){
		List<ShopEntity> shops = shopMapper.searchShops(shopEntity);
		return shops;
	}
	
	public List<ShopEntity> findShopsByAttens(long id){
		List<ShopEntity> shops = shopMapper.findShopsByAttens(id);
		return shops;
	}
	
	public ShopEntity findOneShopEntity(long id){
		ShopEntity shop = shopMapper.findOneShopEntity(id);
		return shop;
	}
	
	public void updateShop(ShopEntity shopEntity){
		shopMapper.updateShop(shopEntity);
	}

}
